<?php
namespace app\api\job;

use think\facade\Log;
use think\queue\Job;
use app\api\controller\UserAuth;


class PlayerReport {
    public function fire(Job $job, $data)
    {
        $collections = json_decode($data,true);
        Log::info("玩家数据上报数据：".json_encode($collections));
        //数据上报
        $auth = new UserAuth();
        $res = $auth->reportLogInOutJob($collections);
        Log::info("玩家数据上报数据返回：".json_encode($res));
        $job->delete();
    }

    public function failed($data)
    {
        $type = $data['type'] == 1 ? '登录' : '退出';
        Log::error("玩家".$type."数据上报失败");
    }
}
